package com.ctshk.rpc.custom.mapper;

import com.ctshk.rpc.custom.dto.quotation.ServiceTypeDTO;
import com.ctshk.rpc.custom.entity.CustomizedQuotationFreeQuoteServiceItems;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 自由报价套餐服务项目 Mapper 接口
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-16
 */
public interface CustomizedQuotationFreeQuoteServiceItemsMapper extends BaseMapper<CustomizedQuotationFreeQuoteServiceItems> {

    /**
     * 查询项目分类
     * @param packageId
     * @return
     */
    @Select("SELECT service_type_name \n" +
            "FROM t_customized_quotation_free_quote_service_items\n" +
            "WHERE package_id = #{package_id} AND quotation_id = #{quotation_id} AND is_deleted = 0 GROUP BY service_type_name")
    List<ServiceTypeDTO> queryServiceTypeList(@Param("package_id") Long packageId,@Param("quotation_id")Long quotationId);


    @Update("UPDATE t_customized_quotation_free_quote_service_items \n" +
            "SET is_deleted = 1,modified_id = #{modified_id}\n" +
            "WHERE quotation_id = #{quotation_id}")
    Integer clearData(@Param("quotation_id") Long quotationId, @Param("modified_id") long userId);
}
